print('pre extra_script.py')
import os

Import("env")
print(env['PLATFORM'])
env.Replace(LINKFLAGS=[i for i in env['LINKFLAGS'] if i not in ['-nostartfiles', '-nostdlib']])
# e.Append(LINKFLAGS = [ "--specs=nano.specs", "--specs=nosys.specs" ])
# access to global construction environment
# print env

# Dump construction environments (for debug purpose)
# print( env.Dump())

# def before_buildprog(source, target, env):
#     print("before_buildprog")
#     print(os.getcwd())
# if os.path.exists('web'):
#     os.system("makefsdata.exe web")

# env.Append(ldscript='stm32f103ve.ld')

BUILD_NUMBER = os.environ.get('CI_BUILD_NUMBER') or os.environ.get('BUILD_NUMBER') or "0"
print("BUILD_NUMBER=%s\n" % BUILD_NUMBER)
env.Append(BUILD_FLAGS=['-DBUILD_NUMBER=%s' % BUILD_NUMBER])
